<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>待办事务管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {

	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
	function chuli(di, itemId, iid, step,apply,suspend) {
		if(apply == 1){
			alert("此事务挂起审核申请中不能处理！请先取消挂起！");
			return;
		} 
		if(suspend == "3"){
			alert("此事务挂起中不能处理！请先解挂！");
			return;
		}
		var winObj = window.open(di + "/ta/chuLi/list?ItemId=" + itemId
				+ "&iid=" + iid + "&step=" + step);
		var loop = setInterval(function() {
			if (winObj.closed) {
				clearInterval(loop);
				//alert('closed');      
				parent.location.reload();
			}
		}, 1);
	}
	function remark(remarkInfo) {
		$("#remark").css("display", "block");
		$("#remark").children("p").html("");
		$("#remark").children("p").append(remarkInfo);
	}
	function remarkOff() {
		$("#remark").css("display", "none");
	}
	function toUnicode(s){ 
        return s.replace(/([\u4E00-\u9FA5]|[\uFE30-\uFFA0])/g,function(newStr){
          return "\\u" + newStr.charCodeAt(0).toString(16); 
　　　　}); 
　　} 
	
	function gua(di,iid,name){
		name = toUnicode(name);
		location = di+"/ta/xtSuspendApply/toAdd?iid="+iid+"&name="+name;
	}
	
</script>
<style type="text/css">
#remark {
	margin-left: 20%;
	margin-top: 10%;
	width: 400px;
	height: 250px;
	background-color: #fff;
	border: 1px solid #ccc;
	position: fixed;
	left: 0;
	top: 0;
}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/ta/workListForWorklistNode/">待办事务列表</a></li>
		<shiro:hasPermission name="ta:workListForWorklistNode:edit">
			<li><a href="${ctx}/ta/workListForWorklistNode/form">待办事务添加</a></li>
		</shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="workListForWorklistNode"
		action="${ctx}/ta/workListForWorklistNode/" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<ul class="ul-form">
			<li><label>业务编号：</label> <form:input path="顺序号"
					htmlEscape="false" maxlength="19" class="input-medium" /></li>
			<li><label>申请单位：</label> <form:input path="申请单位"
					htmlEscape="false" maxlength="512" class="input-medium" /></li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary"
				type="submit" value="查询" /></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>处理</th>
				<th>业务编号</th>
				<th>案件类型</th>
				<th>申请单位</th>
				<th>接收时间</th>
				<th>前一用户</th>
				<th>剩余工作日</th>
				<th>所在岗位</th>
				<th>优先级</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="workListForWorklistNode">
				<tr>
					<td><a
						href="javascript:chuli('${ctx}','${workListForWorklistNode.wiid}','${workListForWorklistNode.顺序号}','${workListForWorklistNode.所在岗位}','${workListForWorklistNode.xtSuspendApply.isdelete }',<c:if test='${empty workListForWorklistNode.stSuspend }'>1</c:if><c:if test='${!empty workListForWorklistNode.stSuspend.endUserid }'>2</c:if><c:if test='${empty workListForWorklistNode.stSuspend.applyId}'>4</c:if><c:if test='${empty workListForWorklistNode.stSuspend.endUserid && !empty workListForWorklistNode.stSuspend.applyId}'>3</c:if>)">处理</a></td>
					<td>${workListForWorklistNode.顺序号}</td>
					<td>${workListForWorklistNode.案件类型}</td>
					<td>${workListForWorklistNode.申请单位}</td>
					<td><fmt:formatDate value="${workListForWorklistNode.接收时间}"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td><c:if test="${workListForWorklistNode.isback == 1}">
							<a href="javascript:remark('${workListForWorklistNode.remark }')">${workListForWorklistNode.前一用户}</a>
						</c:if> <c:if test="${workListForWorklistNode.isback != 1}">${workListForWorklistNode.前一用户}</c:if>
					</td>
					<td>${workListForWorklistNode.剩余工作日}</td>
					<td>${workListForWorklistNode.所在岗位}</td>
					<td><c:if test="${workListForWorklistNode.优先级 == 0}">
							<span style="color: blue">普通件</span>
						</c:if> <c:if test="${workListForWorklistNode.优先级 == 1}">
							<span style="color: yellow">加急件</span>
						</c:if> <c:if test="${workListForWorklistNode.优先级 == 2}">
							<span style="color: red">特急件</span>
						</c:if></td>

					<td><c:if
							test="${empty workListForWorklistNode.xtSuspendApply && empty workListForWorklistNode.stSuspend}">
							<a
								href="javascript:gua('${ctx}','${workListForWorklistNode.顺序号}','${workListForWorklistNode.所在岗位}')"
								onclick="return confirmx('确认要挂起该待办事务吗？', this.href)">挂起</a>
						</c:if> <c:if
							test="${workListForWorklistNode.xtSuspendApply.isdelete ==2 || !empty workListForWorklistNode.stSuspend.endUserid}">
							<a
								href="javascript:gua('${ctx}','${workListForWorklistNode.顺序号}','${workListForWorklistNode.所在岗位}')"
								onclick="return confirmx('确认要重新挂起该待办事务吗？', this.href)">重新挂起</a>
						</c:if> <c:if
							test="${workListForWorklistNode.xtSuspendApply.isdelete == 1}">
							<a
								href="${ctx}/ta/xtSuspendApply/esc?id=${workListForWorklistNode.xtSuspendApply.id}"
								onclick="return confirmx('确认要取消挂起该待办事务吗？', this.href)">取消挂起</a>
						</c:if> <c:if
							test="${!empty workListForWorklistNode.stSuspend && empty workListForWorklistNode.stSuspend.endUserid && !empty workListForWorklistNode.stSuspend.applyId}">已挂起</c:if></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<div id="remark" style="display: none;">
		<h4 align="center" style="margin-top: 2%">回退说明：</h4>
		<input type="button" value="X"
			style="float: right; margin-top: -28px; background-color: #fff; border: none;"
			onclick="remarkOff()" />
		<p align="left"
			style="width: 360px; height: 200px; border: 1px solid #ccc; margin-left: 5%; margin-top: 1%"></p>
	</div>
</body>
</html>